home *** CD-ROM | disk | FTP | other *** search
INI File | 1997-09-07 | 8.0 KB | 224 lines |
- [script]
- n0=;
- n1=; this section deals with XDCC
- n2=;
- n3=alias sendfile {
- n4= ; file number $1 to nick $2
- n5= set %file $readini $mircdirxdcc\files.ini FullPath $1
- n6= set %size $readini $mircdirxdcc\files.ini Bytes $1
- n7= raw -q notice $2 :Now sending $nopath(%file) ( $+ %size bytes)
- n8= dcc send $2 %file
- n9= xlog Send: $nopath(%file) to $2
- n10= xnote 5,0Sending: $nopath(%file) to $2
- n11= set %tvticks [ $+ [ [ $2 ] [ $+ [ %file ] ] ] ] $ticks
- n12= set %sends $readini $mircdirxdcc\files.ini sends $nopath(%file)
- n13= inc %sends
- n14= writeini $mircdirxdcc\files.ini sends $nopath(%file) %sends
- n15=}
- n16=alias removetimer {
- n17= %p = 0
- n18= :nx
- n19= inc %p
- n20= if %xdccm [ $+ [ %p ] ] = $1 {
- n21= %temp = 279 + %p
- n22= .timer $+ %temp off
- n23= %xdccm [ $+ [ %p ] ] = ""
- n24= }
- n25= if %p < 10 goto nx
- n26=}
- n27=alias sendxdccmsg {
- n28= %freeslots = %xdccslots - $send(0)
- n29= %freequeue = %xdccqueue - %inque
- n30= if (%xcheckspeed) msg $1 Slots: %freeslots of %xdccslots open, queue %freequeue $+ / $+ %xdccqueue $+ , mimimum speed %xdccmb $+ kbs
- n31= else msg $1 Slots: %freeslots of %xdccslots open, queue %freequeue $+ / $+ %xdccqueue $+ , mimimum speed: none
- n32= set %playto $1
- n33= play -c $me $mircdirxdcc\xdccmsg.txt %linedelay
- n34=}
- n35=alias onexdccmsg {
- n36= if (($left($1,1) = $chr(35)) && ($me !ison $1)) { echo 4 -a You're not on $1 $+ ! | dh }
- n37= sendxdccmsg $1
- n38=}
- n39=alias doxdccmsg {
- n40= if (($left($1,1) = $chr(35)) && ($me !ison $1)) { echo 4 -a Halting timer to send xdcc info to $1 (you're not there!) | removetimer $1 | dh }
- n41= sendxdccmsg $1
- n42=}
- n43=alias xdccmsg {
- n44= ; timed message to $1 using delay $2
- n45= %i = 0
- n46= :nx
- n47= inc %i
- n48= if %xdccm [ $+ [ %i ] ] = $null {
- n49= set %xdccm [ $+ [ %i ] ] $1
- n50= %temp = 279 + %i
- n51= .timer $+ %temp 0 $2 doxdccmsg $1
- n52= }
- n53= else {
- n54= if %i = 10 { echo 4 -a Sorry, you already have 10 timed xdcc messages going :( | goto end }
- n55= else goto nx
- n56= }
- n57= :end
- n58= doxdccmsg $1
- n59=}
- n60=alias loadxdccoptions {
- n61= .timer967 off
- n62= set %xdccmb $readini $mircdirxdcc\files.ini General Speed
- n63= %xspeed = %xdccmb * 1024
- n64= set %xcheckspeed $readini $mircdirxdcc\files.ini General CheckSpeed
- n65= set %xlog $readini $mircdirxdcc\files.ini General Speed
- n66= set %xdccslots $readini $mircdirxdcc\files.ini General Slots
- n67= set %xdccqueue $readini $mircdirxdcc\files.ini General Queue
- n68= if (($group(#XDCC) = on) && (%xcheckspeed)) .timer967 0 15 checkspeed
- n69=}
- n70=alias slotopen {
- n71= if ($send(0) < %xdccslots) return $true
- n72= return $false
- n73=}
- n74=alias qopen {
- n75= if %tvquenick [ $+ [ %xdccqueue ] ] = $null return $true
- n76= else return $false
- n77=}
- n78=alias addtoqueue {
- n79= ; add send of file index $1 to nick $2 to first available position in queue
- n80= %q = 0
- n81= :nx
- n82= inc %q
- n83= if (%tvquenick [ $+ [ %q ] ] != $null) goto nx
- n84= set %tvquenick [ $+ [ %q ] ] $2
- n85= set %tvquefile [ $+ [ %q ] ] $1
- n86= raw -q notice $2 :You are # $+ %q in queue
- n87=}
- n88=alias takefromque {
- n89= if (($slotopen) && (%tvquenick1 != $null)) {
- n90= sendfile %tvquefile1 %tvquenick1
- n91= advanceque | takefromque
- n92= }
- n93=}
- n94=alias advancequeue {
- n95= %q1 = 0 | %q2 = 1
- n96= :nx
- n97= inc %q1 | inc %q2
- n98= if (%tvquenick [ $+ [ %q2 ] ] != $null) {
- n99= set %tvquenick [ $+ [ %q1 ] ] %tvquenick [ $+ [ %q2 ] ]
- n100= set %tvquefile [ $+ [ %q1 ] ] %tvquefile [ $+ [ %q2 ] ]
- n101= raw -q notice %tvquenick [ $+ [ %q1 ] ] :Queue position: %q1
- n102= goto nx
- n103= }
- n104=}
- n105=alias enablexdcc {
- n106= .enable #xdcc
- n107= window -a @XDCC 20 20 500 200 $mircdirxdcc\popup.txt
- n108= echo 4 -a XDCC is now enabled | alert
- n109= loadxdccoptions
- n110=}
- n111=alias disablexdcc {
- n112= .timer167 off | window -c @XDCC
- n113= if $group(#XDCC) = on echo 4 -a XDCC is now disabled
- n114= else echo 4 -a XDCC is not enabled
- n115= alert
- n116=}
- n117=alias xdccwin if $window(@XDCC) = $null window -an @XDCC 20 20 500 200 $mircdirxdcc\popup.txt
- n118=alias xnote {
- n119= xdccwin
- n120= if $window(@XDCC).state = minimized aline -h @XDCC $1-
- n121= else aline @XDCC $1-
- n122=}
- n123=alias xlog if (%xlog) write $mircdirlogs\xdcc.log $realtime $adate $1-
- n124=alias checkspeed {
- n125= if (($group(#XDCC) = off) || ($server = $null)) { .timer167 off | halt }
- n126= %k = 0
- n127= :nx
- n128= inc %k
- n129= if ($send(%k) != $null) {
- n130= if $send(%k).cps < %xspeed {
- n131= xnote 4,0Closing send(s) to $send(%k) 3,0(speed is $send(%k).cps cps)
- n132= close -s $send(%k) | raw -q notice $send(%k) :Closing sends (minimum speed requirement not obtained)
- n133= takefromque
- n134= }
- n135= goto nx
- n136= }
- n137=}
- n138=alias killsends {
- n139= %k = 0 | %num = 0
- n140= :nx
- n141= inc %k
- n142= if ($send(%k) != $null) {
- n143= if ($send(%k) = $1) { close -s $send(%k) | inc %num }
- n144= goto nx
- n145= }
- n146= if %num = 0 echo 4 -a There are no sends to $1
- n147= elseif %num = 1 echo 4 -a Killed 1 send to $1
- n148= else echo 4 -a Killed %num sends to $1
- n149=}
- n150=alias excessxdcc {
- n151= xlog Excessive requests from $1 $+ , ignoring for 5 minutes
- n152= xnote Excessive XDCC requests from $1- $+ , ignoring for 5 minutes
- n153= .ignore -t $mask($1,3) | .timer 1 300 .ignore -r $mask($1,3)
- n154=}
- n155=#XDCC off
- n156=ctcp 1:XDCC LIST:{
- n157= if $ulevel < 18 {
- n158= inc %xxd [ $+ [ $site ] ] | .timer 1 30 unset %xxd [ $+ [ $site ] ]
- n159= if (%xxd [ $+ [ $site ] ] > 5) { excessxdcc $fulladdress | halt }
- n160= }
- n161= set %xnick $nick
- n162= play -c $me $mircdirxdcc\xdcclst.txt 1500
- n163= xnote 5,0 $+ $nick ( $+ $mask( [ $fulladdress ] ,3) $+ ) List
- n164= xlog $nick ( $+ $mask( [ $fulladdress ] ,3) $+ ) List
- n165=}
- n166=ctcp 1:XDCC SEND:{
- n167= if $ulevel < 18 {
- n168= inc %xxd [ $+ [ $site ] ] | .timer 1 30 unset %xxd [ $+ [ $site ] ]
- n169= if (%xxd [ $+ [ $site ] ] > 5) { excessxdcc $fulladdress | halt }
- n170= }
- n171= set %len $len($3) | dec %len
- n172= set %send $right($3,%len)
- n173= set %file $readini $mircdirxdcc\files.ini FullPath %send
- n174= if %file = $null {
- n175= xnote 4,0Erroneous Request: 3,0 $+ $3 (from $fulladdress $+ )
- n176= xlog Erroneous Request: $3 (from $fulladdress $+ )
- n177= raw -q notice $nick :No such file: $+ $3 $+ .
- n178= halt
- n179= }
- n180= if ($slotopen) sendfile %send $nick
- n181= elseif ($qopen) addtoqueue %send $nick
- n182= else raw -q notice $nick :Slots and queue are filled; try later
- n183=}
- n184=on 1:SENDFAIL:*:{
- n185= xlog Send Failed: $filename to $nick
- n186= xnote 5,0Send Failed: $filename to $nick
- n187= takefromque
- n188=}
- n189=on 1:GETFAIL:*:{
- n190= xlog Get Failed: $filename from $nick
- n191= xnote 5,0Get Failed: $filename from $nick
- n192=}
- n193=on 1:FILERCVD:*:{
- n194= xlog Received: $nopath($filename) from $nick
- n195= set %size $lof($filename)
- n196= xnote 5,0Received: $filename from $nick ( $+ %size bytes $+ )
- n197=}
- n198=on 1:FILESENT:*:{
- n199= if (%tvticks [ $+ [ [ $nick ] [ $+ [ $filename ] ] ] ] != $null) {
- n200= set %size $lof($filename)
- n201= set %tvticks $ticks
- n202= %tvticks = $ticks - %tvticks [ $+ [ [ $nick ] [ $+ [ $filename ] ] ] ]
- n203= %seconds = %tvticks / 1000
- n204= %cps = %size / %seconds
- n205= %kbs = %cps / 1024
- n206= set %old $readini $mircdirxdcc\files.ini record $nopath($filename)
- n207= if %kbs > %old writeini $mircdirxdcc\files.ini record $nopath($filename) %kbs
- n208= xlog Sent: $nopath($filename) to $nick ( $+ %kbs kbs)
- n209= xnote 5,0Sent: $nopath($filename) to $nick ( $+ %kbs kbs)
- n210= %size = %size / 1024
- n211= %sent = $readini $mircdirxdcc\files.ini General TotalSent
- n212= %sent = %sent + %size
- n213= writeini $mircdirxdcc\files.ini General TotalSent %sent
- n214= }
- n215= else {
- n216= xlog Sent: $nopath($filename) to $nick
- n217= xnote 5,0Sent: $nopath($filename) to $nick
- n218= }
- n219= takefromque
- n220=}
- n221=#XDCC end
-